﻿    <div class="site_map" align="left">Phản hồi</div>
    <div class="heading">
        <div class="heading_left"></div>
        <div class="heading_right"></div>
        <div class="heading_center">
            <img src="/onlinemarket/img/cus_menu_mess.png" style="float: left; margin-top: 10px;"/>
        	<h3>Phản hồi</h3>
        </div>

        <div class="table">
            <h1 id="topTable">&nbsp;</h1>
            <form method="post" action="/onlinemarket/feedbacks/save">
                <table style="padding-left: 20px;" class="noborder">
                    <tr>
                        <td style="width: 70px;">Gửi đến: </td>
                        <td><textarea style="width: 900px; resize:vertical;" id="mailto" name="mailto" ></textarea></td>
                    </tr>
                    <tr>
                        <td>Chủ đề: </td>
                        <td><input style="width: 900px; height: 23px;" id="mailtitle" name="mailtitle"/></td>
                    </tr>
                    <tr>
                        <td colspan="2">Nội dung: </td>
                    </tr>
                    <tr>
                        <td colspan="2"><textarea style="width: 973px; height: 263px; resize: none;"></textarea></td>
                    </tr>
                    <tr>
                        <td colspan="2" style="text-align: right;">
                            <input type="submit" value="Gửi"/>
                            <input type="button" value="Lưu lại"/>
                            <input type="button" value="Hủy" onclick="onCancel()"/>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
<table class="border" style="width: 100%;">
   <tr>
        <th>Người phản hồi</th>
        <th>Người nhận</th>
        <th>Email</th>
        <th>Thời gian gửi</th>
        <th>Nội dung</th>
        <th>Chức năng</th>
    </tr>

<?php foreach ($feedbacks as $feed) : ?>
<tr>
    <td> <?php if ($feed['Feedback']['status'] != 1) echo('Hệ thống'); 
    else echo($feed['Customer']['lastname']." ".$feed['Customer']['firstname']."_".$feed['Feedback']['customer_id']); ?></td>
    <td> <?php if ($feed['Feedback']['status'] == 1) echo('Hệ thống'); 
    else echo($feed['Customer']['lastname']." ".$feed['Customer']['firstname']."_".$feed['Feedback']['customer_id']); ?></td>
    <td> <?php if ($feed['Feedback']['status'] != 1) echo($feed['Customer']['email']); else echo("&nbsp;"); ?>&nbsp;</td>
    <td> <?php if ($feed['Feedback']['date'] != "") echo(date("d-m-Y H:m:s", strtotime($feed['Feedback']['date']))); ?>&nbsp;</td>
    <td><?php echo($feed['Feedback']['feContent']); ?></td>
    <td>
        <?php if ($feed['Feedback']['status'] == 1) {?>
            <img alt="Trả lời" title="Trả lời" style="cursor: pointer;" width="16" src="/onlinemarket/img/review.png" onclick="answer(<?php echo($feed['Feedback']['customer_id']); ?>)"/>
        <?php } ?>
    &nbsp;</td>
</tr>
<?php endforeach; ?>

</table>
<div style="text-align: right;">
    <?php echo $this->Paginator->numbers();?>
    <?php echo $this->Paginator->prev('« Previous', null, null, array('class' => 'disabled')); ?>
    <?php echo $this->Paginator->next('Next »', null, null, array('class' => 'disabled')); ?>
</div>
</div>
<script>

    function answer(id) {
        window.location = "/onlinemarket/feedbacks/index/" + id;
    }
    function onCancel() {
        $('form:first').slideUp('slow');
        $('#topTable').hide();
    }
    function getQueryVariable(variable) {
        var query = window.location.search.substring(1);
        var vars = query.split('&');
        for (var i=0; i<vars.length; i++) {
            var pair = vars[i].split('=');
            if (pair[0] == variable) {
                return pair[1];
            }
        }
    };

    $(document).ready(function() {
        $("input:submit, input:button").css('height', '25px');
        $("input:submit, input:button").css('padding-top', '0.3em');
        $("input:submit, input:button").button();
    });
</script>
